﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BGM_Project_ReaderDtls.aspx.cs" Inherits="KPIS.GERP.GBMS.APP_UI.Form.BGM_Project_ReaderDtls" %>

<%@ Register src="../UserControls/DatePicker.ascx" tagname="DatePicker" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>มอบหมายงาน</title>
    <script src="../../Scripts/DatePicker.js" type="text/javascript"></script>
    <script src="../../Scripts/Common.js" type="text/javascript"></script>
    <link href="../../Styles/StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server" style="font-size:small">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" 
            OnAjaxRequest="RadAjaxManager1_AjaxRequest">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="pnlInfo">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="pnlInfo" />
                        <telerik:AjaxUpdatedControl ControlID="dtgAssignCtrl" />
                        <telerik:AjaxUpdatedControl ControlID="AddNew" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="dtgAssignCtrl">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="pnlInfo" />
                        <telerik:AjaxUpdatedControl ControlID="dtgAssignCtrl" />
                        <telerik:AjaxUpdatedControl ControlID="AddNew" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="AddNew">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="pnlInfo" />
                        <telerik:AjaxUpdatedControl ControlID="dtgAssignCtrl" />
                        <telerik:AjaxUpdatedControl ControlID="AddNew" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" BackgroundPosition="None"> 
        </telerik:RadAjaxLoadingPanel>

        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">

                function openDetail(seq) {
                    radopen("ProjectJobAssigneeList.aspx?seq=" + seq, "Popup");
                }

                function closeRadWindow(sender, args) {
                    $find('<%= RadAjaxManager1.ClientID %>').ajaxRequest();
                }

                function alertCancel() {
                    confirm('ต้องการยกเลิกข้อมูลใช่หรือไม่');
                }
    
            </script>

        </telerik:RadCodeBlock>

        <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
            <Windows>
                <telerik:RadWindow ID="Popup" Modal="true" Skin="WebBlue" ReloadOnShow="true" 
                    ShowContentDuringLoad="false" VisibleStatusbar="false" runat="server" 
                    width="800px" Height="400px" Behaviors="Reload, Close" OnClientClose="closeRadWindow" >
                </telerik:RadWindow>
            </Windows>
        </telerik:RadWindowManager> 

    <asp:Panel ID="pnlAll" runat="server">
    <div style="margin-bottom: 21px">
       	<asp:LinkButton ID="AddNew" runat="server" CausesValidation="false" CssClass="LinkButton" 
            onclick="AddNew_Click"><img alt="" src="../Image/Grid/AddRecord.gif" />&nbsp;&nbsp;เพิ่มงานที่ต้องทำในโครงการ</asp:LinkButton>
        <telerik:RadGrid GroupingSettings-CaseSensitive="false" ID="dtgAssignCtrl" runat="server"
            AllowFilteringByColumn="true" AllowMultiRowSelection="false" AllowPaging="true" AllowSorting="true"
            AutoGenerateColumns="false" PageSize="10" 
            OnNeedDataSource="dtgAssignCtrl_NeedDataSource" 
            OnItemCommand="dtgAssignCtrl_ItemCommand">

            <MasterTableView AllowMultiColumnSorting="true" DataKeyNames="bgm_proj_job_assign_seq" ClientDataKeyNames="bgm_proj_job_assign_seq" Width="100%">
                <PagerStyle Mode="NextPrevAndNumeric" />
                <Columns>
                    <telerik:GridBoundColumn HeaderText="PK"  UniqueName="bgm_proj_job_assign_seq" DataField="bgm_proj_job_assign_seq" Visible="false"></telerik:GridBoundColumn>
                    <Telerik:GridBoundColumn UniqueName="job_status_seq" DataField="job_status_seq" Visible="false"></telerik:GridBoundColumn>
                    <telerik:GridButtonColumn HeaderText="แก้ไข" ImageUrl="../Image/Grid/Edit.gif" ButtonType="ImageButton" CommandName="GridEdit">
                        <HeaderStyle Width="40px" />
                    </telerik:GridButtonColumn>
                    <telerik:GridTemplateColumn HeaderText="ลบ" AllowFiltering="false">
                        <HeaderStyle Width="40px" />
                        <ItemTemplate>
                            <asp:ImageButton ImageUrl="../Image/Grid/Delete.gif" ID ="imgDelete" OnClientClick="javascript:return confirm('ยืนยันการลบข้อมูลที่เลือก')" CommandName="GridDelete" runat="server"/>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn HeaderText="job_description" DataField="job_description" UniqueName="job_description" Visible="false"
                        ShowFilterIcon="false" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" FilterControlWidth="100%">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="งานที่ต้องทำในโครงการ" DataField="job_title" UniqueName="job_title"
                        ShowFilterIcon="false" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true"  FilterControlWidth="100%">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="emp_count2" DataField="emp_count" UniqueName="emp_count2" Visible="false"
                        ShowFilterIcon="false" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true"  FilterControlWidth="100%">
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn HeaderText="จำนวนผู้ที่รับผิดชอบ" UniqueName="emp_count" DataField="emp_count" 
                        ShowFilterIcon="false" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true"  FilterControlWidth="100%">
                        <HeaderStyle Width="70px" />
                        <ItemTemplate>
                            <asp:LinkButton ID="lbn" runat="server"
                                OnClientClick='<%# string.Format("return openDetail(\"{0}\");", Eval("bgm_proj_job_assign_seq")) %>'><%# Eval("emp_count") %></asp:LinkButton>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn HeaderText="วันที่ดำเนินงาน" DataField="job_start_date" UniqueName="job_start_date" DataFormatString="{0:d}"
                        ShowFilterIcon="false" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" FilterControlWidth="100%">
                        <HeaderStyle Width="120px" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="วันที่สิ้นสุด" DataField="job_end_date" UniqueName="job_end_date" DataFormatString="{0:d}"
                        ShowFilterIcon="false" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" FilterControlWidth="100%">
                        <HeaderStyle Width="120px" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="สถานะงาน" DataField="job_status_name" UniqueName="job_status_name"
                        ShowFilterIcon="false" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" FilterControlWidth="100%">
                        <HeaderStyle Width="120px" />
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>     
        </telerik:RadGrid>

        <div>
            <asp:Panel ID="pnlInfo" runat="server">
             <div class="header-grid">
             <asp:Label ID="lblModeName" runat="server" />
             </div>
               <table width="700px">
                <tr>
                    <td width="120px">หัวข้องาน :</td>
                    <td colspan="3">
                        <asp:Label ID="lblBgmProjJobAssignSeq" runat="server" Text="Label" Visible="false"></asp:Label>
                        <asp:Label ID="lblEmpCount" runat="server" Text="Label" Visible="false"></asp:Label>
                        <asp:Label ID="ddlEmployeeList" runat="server" Visible="false"></asp:Label>
                        <telerik:RadTextBox ID="txtTitle" runat="server" Width="500px">
                        </telerik:RadTextBox>
                    </td>
                </tr>
                <tr>
                    <td width="120px">รายละเอียดงาน :</td>
                    <td colspan="3">
                        <telerik:RadTextBox ID="txtDes" runat="server" TextMode="MultiLine" Height="80px" Width="500px">
                        </telerik:RadTextBox>
                    </td>
                </tr>
                <tr>
                    <td width="120px">วันที่ดำเนินงาน :</td>
                    <td width="300px">
                        <uc1:DatePicker ID="txtStart" runat="server" />
                    </td>
                    <td width="120px">วันที่สิ้นสุด :</td>
                    <td>
                        <uc1:DatePicker ID="txtEnd" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td width="120px" class="style2">สถานะงาน :</td>
                    <td colspan="3" class="style2">
                        <telerik:RadComboBox ID="ddlStatus" runat="server" DataValueField="job_status_seq"
                        DataTextField="job_status_name"  Filter="Contains"  
                            EmptyMessage="---กรุณาระบุสถานะ---" HighlightTemplatedItems="true">
                        </telerik:RadComboBox>
                    </td>
                </tr>
                <tr>
                    <td colspan="4" align="center" height="30px">
                    <asp:LinkButton ID="btnUpdate" runat="server" Text="บันทึก" Width="80px" CssClass="LinkButton"
                                OnClientClick="javascript:return confirm('ต้องการแก้ไขข้อมูลใช่หรือไม่')"
                                onclick="btnUpdate_Click" Height="16px" />
                    <asp:LinkButton ID="btnOk" runat="server" Text="บันทึก" Width="80px" CssClass="LinkButton" 
                                OnClientClick="javascript:return confirm('ต้องการบันทึกข้อมูลใช่หรือไม่')" 
                                onclick="btnOk_Click" Height="16px" />&nbsp;&nbsp;&nbsp;
                     <asp:LinkButton ID="btnCancle" runat="server" Text="ยกเลิก" Width="80px" CausesValidation="false" CssClass="LinkButton"
                                OnClientClick="javascript:return confirm('ต้องการยกเลิกข้อมูลใช่หรือไม่')"
                                onclick="btnCancle_Click" />
                    </td>
                </tr>
               </table>
            </asp:Panel>
        </div>

    </div>
    </asp:Panel>
    </form>
</body>
</html>
